//
//  BukaLoginManager.h
//  BukaSDKFoundation
//
//  Created by 曹飞 on 2018/2/26.
//  Copyright © 2018年 tv.buka. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BukaSysUserModel.h"
@interface BukaLoginManager : NSObject

@property (nonatomic,strong) NSString * device; //请自行设置唯一ID 每个账号登陆保持相同的id
@property (nonatomic,strong) NSString * token; //布卡系统唯一标识符，初始为空，需要 通过bukaUserSystemLogin 获得,登出时清空
@property (nonatomic,strong) BukaSysUserModel * bukaUserModel;//布卡系统用户信息，初始为空，需要 通过bukaUserSystemLogin 获得,登出时清空


+ (instancetype)sharedInstance;

/**
 *  用户登录到布卡系统
 *  用户系统对接 绑定获得的用户名密码
 *  @param username 登录名
 *  @param pwd      密码
 *  @param device   UUID或者广告标识符
 *  @param block    返回token用户相关信息
 */
-(void)loginBukaUserSystem:(NSString*)username
                   withPwd:(NSString*)pwd
                withDevice:(NSString*)device
                 withBlock:(void (^)(id result, NSError *error))block;


/**
 用户登录到布卡系统 通过验证码

 @param username 手机号
 @param code 验证码
 @param device UUID或者广告标识符
 @param block 返回token用户相关信息
 */
-(void)loginBukaUserSystem:(NSString*)username
                   withCode:(NSString*)code
                withDevice:(NSString*)device
                 withBlock:(void (^)(id result, NSError *error))block;


/**
 登出布卡用户系统 ，会清空token device
 
 @param block block description
 */
-(void)logoutBukaUserSystem:(NSString*)device
                  withToken:(NSString*)token
                  withBlock:(void (^)(id result, NSError *error))block;






/**
 获取用户在当前房间的权限

 @param roomID 房间id
 @param token Token
 @param device device
 @param block block
 返回值
 {
 "user_relation": 5
 }
 为了区分role字段，使用user_relation
 * user_relation:
 *      1.主讲老师
 *      2.普通学生（只有这个角色该弹窗弹窗，改付费付费）
 *      3.助教老师
 *      4.隐形人
 *      5.白名单内学生以及创建者
 */
-(void)getRoomRoleWithRoomID:(NSString*)roomID
                   withToken:(NSString*)token
                  withDevice:(NSString*)device
                   withBlock:(void (^)(id result, NSError *error))block;


/**
 获取房间信息
 
 @param roomID 房间id
 @param block block
 */
-(void)getRoomInfo:(NSString *)roomID
         withBlock:(void (^)(id result, NSError *error))block;



/**
 获取房间信息 用别名
 
 @param roomid 房间别名
 @param type 1 代表id  2代表别名
 @param device device
 @param token token
 @param block block
 */
-(void)getRoomInfo:(NSString *)roomid
          withType:(NSInteger)type
        withDevice:(NSString*)device
         withToken:(NSString*)token
         withBlock:(void (^)(id result, NSError *error))block;




/**
 *  登录房间验证 roomEncryptionType = 0  没有密码
 *  服务端自动返回role 然后需要手动链接信令
 *  @param room_id 房间id
 
 *  @param block   登录回调
 
 */
-(void)loginRoomWithRoomID:(NSString *)room_id
                  withBlock:(void (^)(id result, NSError *error))block;

/**
 *  登录房间验证 roomEncryptionType = 1 有密码
 *  服务端自动返回role并进行连接房间，用于推流时区分主讲和其他用户推的流
 *  @param room_id 房间id
 *  @param pwd     密码
 *  @param block   登录回调
 
 */
-(void)loginRoomWithRoomID:(NSString*)room_id
                   withPwd:(NSString*)pwd
                 withBlock:(void (^)(id result, NSError *error))block;
/**
 登录房间验证 roomEncryptionType = 2 白名单
 
 @param room_id 房间id
 @param role 权限
 
 @param block 登录回调
 */
-(void)loginWhiteListRoomWithRoomID:(NSString*)room_id
                           withRole:(int)role
                          withBlock:(void (^)(id result, NSError *error))block;


/**
 *  登录房间验证 roomEncryptionType = 3 回调验证
 *  服务端自动返回role并进行连接房间，用于推流时区分主讲和其他用户推的流
 *  @param room_id     房间id
 *  @param login_id    用户登录布卡用户系统时的login_id
 *  @param login_nickname    用户昵称login_nickname
 *  @param token       token
 *  @param role        权限
 *  @param block       登录回调
 
 */
-(void)loginCallBackRoomWithRoomID:(NSString*)room_id
                withLoginID:(NSString*)login_id
          withLoginNickName:(NSString*)login_nickname
                  withToken:(NSString*)token
                   withRole:(int)role
                  withBlock:(void (^)(id result, NSError *error))block;


/**
 订单验证

 @param room_id 房间id
 @param block 登录回调
 */
-(void)loginOrderRoomWithRoomID:(NSString *)room_id
                  withBlock:(void (^)(id result, NSError *error))block;


@end
